<?php

namespace App\Http\Requests\activity;

use Illuminate\Foundation\Http\FormRequest;

class ActivityRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        $action = request()->getPathInfo();

        $basics = [

        ];


        switch ($action){
            case '/v1/activity/create':
                $rule = [
                    'title'   =>  'required',
                    'intro' => 'required',
                    'start_time' => 'required',
                    'end_time' => 'required',
                    'apply_end_time' => 'required',
                    'content' => 'required|between:1,120'
                ];
                break;
        }

        return array_merge($basics,$rule);
    }

    public function messages()
    {
        return [
            'phone.unique' => '手机号码已注册!'
        ];
    }

}
